import http from "../http";

function login(params: any = {}) {
	return http.myRequest({
		url: '/auth/wechat/login',
		method: 'post',
		data: params,
		header: {
			'content-type': 'application/x-www-form-urlencoded'
		}
	})
}

function passwordLogin(params: any = {}) {
	return http.myRequest({
		url: '/auth/wechat/passwordLogin',
		method: 'post',
		data: params,
	})
}

function register(params: any = {}) {
	return http.myRequest({
		url: '/auth/wechat/register',
		method: 'post',
		data: params,
	})
}


function refreshToken(params: any = {}) {
	return http.myRequest({
		url: '/auth/refreshToken',
		method: 'post',
		data: params,
		header: {
			'content-type': 'application/x-www-form-urlencoded'
		}
	})
}

function logout(params: any = {}) {
	return http.myRequest({
		url: '/auth/logout',
		method: 'post',
		data: params,
	})
}

//auth
function auth(params: any = {}) {
	return http.myRequest({
		url: '/auth',
		method: 'get',
		data: params,
	})
}

export default {
	login,
	register,
	auth,
	refreshToken,
	logout,
	passwordLogin
}

